package com.yuyou.fn.platform.service.impl;

import com.github.wens.mybatisplus.examples.Example;
import org.springframework.stereotype.Service;

import com.yuyou.fn.platform.mapper.ProvinceMapper;
import com.yuyou.fn.platform.entity.Province;
import com.yuyou.fn.platform.service.IProvinceService;
import com.github.wens.framework.service.impl.SuperServiceImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * Province 表数据服务层接口实现类
 *
 */
@Service
public class ProvinceServiceImpl extends SuperServiceImpl<ProvinceMapper, Province,Long> implements IProvinceService {

    @Override
    public Map<String, Province> findAllProvinceMapByProvinceName() {
        Map<String,Province> provinceMap=new HashMap<>();
        List<Province> provinceList = this.findListByExample(Province.createExample());
        if (provinceList!=null){
            for (Province province:provinceList){
                String key=province.getProvinceName().replaceAll("省","");
                provinceMap.put(key,province);
            }
        }
        return provinceMap;
    }
}